<?php

include(dirname(__FILE__).'/../../bootstrap/functional.php');

$browser = new nutritionTestFunctional(new sfBrowser());
$browser->loadData();
$browser->setTester('doctrine', 'sfTesterDoctrine');
//测试后台首页
$browser->info('1.category index')->
//登录功能
info('  1.1 authentication')->
  get('category/index')->
  with('request')->begin()->
    isParameter('module', 'category')->
    isParameter('action', 'index')->
  end()->
  with('user')->isAuthenticated(false)->  //测试直接访问无权限
info('  1.2 login')->
signin('admin','admin')->
  get('category/index')->
  with('request')->begin()->
    isParameter('module', 'category')->
    isParameter('action', 'index')->
  end()->
  with('user')->isAuthenticated(true)->//测试登陆访问有权限  
info('  1.3 login')->
signout()->
  get('category/index')->
  with('request')->begin()->
    isParameter('module', 'category')->
    isParameter('action', 'index')->
  end()->
  with('user')->isAuthenticated(false)//测试登出访问无权限 
        ;
